package com.sharelords.demo.common.result.helper;

import com.sharelords.demo.common.enums.ReturnCodeEnum;
import com.sharelords.demo.common.result.ViewResult;

/**
 * @Description: 视图结果集帮助类
 *
 * @Author: 千古龙少
 * @Time: 2019/12/7 20:46
 */
public class ViewResultHelper {

    /**
     * 成功
     *
     * @Author: 千古龙少
     * @Time: 2019/12/7 20:47
     * @param t
     * @return com.sharelords.demo.common.result.ViewResult<T>
     */
    public static <T> ViewResult<T> success(T t) {
        return new ViewResult<T>().success(t);
    }

    /**
     * 成功
     *
     * @Author: 千古龙少
     * @Time: 2019/11/20 0:03
     * @param t
     * @param returnMsg
     * @return com.sharelords.demo.web.common.result.ViewResult<T>
     */
    public static <T> ViewResult<T> success(T t, String returnMsg) {
        return new ViewResult<T>().success(t, returnMsg);
    }

    /**
     * 失败
     *
     * @Author: 千古龙少
     * @Time: 2019/11/20 0:03
     * @param returnCodeEnum
     * @return com.sharelords.demo.web.common.result.ViewResult<T>
     */
    public static <T> ViewResult<T> fail(ReturnCodeEnum returnCodeEnum) {
        return new ViewResult<T>().fail(returnCodeEnum);
    }

    /**
     * 失败
     *
     * @Author: 千古龙少
     * @Time: 2019/11/20 0:03
     * @param returnCode
     * @param returnMsg
     * @return com.sharelords.demo.web.common.result.ViewResult<T>
     */
    public static <T> ViewResult<T> fail(Integer returnCode, String returnMsg) {
        return  new ViewResult<T>().fail(returnCode, returnMsg);
    }
}
